const success = ({ code = 0, msg = 'success', data, ...other }) => {
  const result = {
    code,
    msg,
    ...other,
  };
  if (data) {
    result.data = data;
  }
  return result;
};

const fail = ({ code = 1001, msg = 'fail', ...other }) => {
  return {
    code: code,
    msg,
    ...other,
  };
};
const error = ({ code = 1000, msg = 'error', ...other }) => {
  return {
    code: code,
    msg,
    ...other,
  };
};

export default {
  fail,
  error,
  success,
};
